package D240422;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.lang.reflect.Array;
import java.util.Arrays;

public class JsoupDemo02 {
    public static void main(String[] args) throws IOException {
        Document doc = Jsoup.connect("https://so.gushiwen.cn/gushi/shijing.aspx").get();
        Elements elements = doc.getElementsByClass("bookMl");
        int size = doc.getElementsByAttributeValue("target", "_blank").size();
        System.out.println(size);
        Elements title = elements.nextAll();
        Object[] array = title.toArray();
        String text = title.text();
        System.out.println("当前网页列出的诗经总共有" + array.length + "篇");
        System.out.println("他们的标题是：" + text);
    }
}
